<template>
  <a-card class="info" title="员工离职申请单">
     <a-row type="flex"  justify="center" v-if="model">
       <a-col :span="24">
          <erp-hr-employee-resign-bill-form ref="realForm" :disabled="true" normal></erp-hr-employee-resign-bill-form>
          <!-- 流程历史跟踪 -->
          <common-flow-list v-if="model.bpmStatus !== '1'" :formData="formData"></common-flow-list>
       </a-col>
     </a-row>
     <div style="text-align: center;margin-top: 15px;" v-if="model">
        <a-button v-print="'#printContentResign'" type="primary">打印</a-button>
      </div>
     <div v-else>暂无离职信息</div>
     <ErpHrEmployeeResignBillFormPrint
      v-if="model"
      id="printContentResign"
      class="print_style"
      :formData="model"
      :formDataHistory="formData"></ErpHrEmployeeResignBillFormPrint>
     <!-- <erp-hr-employee-resign-bill-modal ref="modalForm" @ok="modalFormOk"></erp-hr-employee-resign-bill-modal>
     <bpm-biz-task-deal-modal ref="taskDealModal" :path="path" :formData="formData"
                             @ok="handleOk"></bpm-biz-task-deal-modal>
     <bpm-process-track-modal ref="bpmProcessTrackModal"></bpm-process-track-modal>
     <biz-task-notify-modal ref="taskNotifyModal"></biz-task-notify-modal>
     <biz-task-notify-me-modal ref="taskNotifyMeModal"></biz-task-notify-me-modal> -->
  </a-card>
</template>

<script>

  import { getAction,postAction } from '@/api/manage'
  import {JeecgBpmListMixin} from '@/mixins/JeecgBpmListMixin'
  // import BizHisTaskModule from "@/views/modules/bpmbiz/common/BizHisTaskModule.vue";
  // import BpmBizTaskDealModal from "@/views/modules/bpmbiz/common/BpmBizTaskDealModal.vue";
  // import BpmProcessTrackModal from "@/views/modules/bpmbiz/common/BpmProcessTrackModal.vue";
  // import BizTaskNotifyModal from "@/views/modules/bpmbiz/common/BizTaskNotifyModal.vue";
  // import BizTaskNotifyMeModal from "@/views/modules/bpmbiz/common/BizTaskNotifyMeModal.vue";
  import ErpHrEmployeeResignBillForm from '@views/erp/hr/resign/modules/ErpHrEmployeeResignBillForm'
  import ErpHrEmployeeResignBillFormPrint from '@views/erp/hr/resign/modules/ErpHrEmployeeResignBillFormPrint'
  import ErpHrEmployeeResignBillModal from '@views/erp/hr/resign/modules/ErpHrEmployeeResignBillModal'
  import {DisabledAuthFilterMixin} from '@/mixins/DisabledAuthFilterMixin'
  import CommonFlowList from '@/views/components/CommonFlowList.vue'; // 审批历史流程列表

  export default {
    name: 'ErpHrEmployeeResignBillDetail',
    mixins: [JeecgBpmListMixin, DisabledAuthFilterMixin],
    components: {
     ErpHrEmployeeResignBillForm,
     ErpHrEmployeeResignBillFormPrint,
     ErpHrEmployeeResignBillModal,
     CommonFlowList
    //  BizHisTaskModule,
    //  BpmBizTaskDealModal,
    //  BpmProcessTrackModal,
    //  BizTaskNotifyModal,
    //  BizTaskNotifyMeModal,
    },
    data () {
      return {
         model: {},
        id: '',
        url: {
          queryById: "/api/erp/hr/resign/erpHrEmployeeResignBill/queryResignByEmployeeId",
          delete: "/api/erp/hr/resign/erpHrEmployeeResignBill/delete",
          bizCount: "/api/erp/hr/resign/erpHrEmployeeResignBill/bizCount",
        },
        confirmLoading: false,
        iconStyle:{"font-size":"20px"},
        //代码生成后需手动设置流程编码
        flowCode: 'onl_erp_hr_employee_resign_bill',
        formUrl: "erp/hr/resign/modules/ErpHrEmployeeResignBillForm",
        formUrlMobile: "",
        disableMixinCreated: true
      }
    },
    props: {
      employeeId: String
    },
    watch: {
      employeeId: {
        handler: function(val){
          this.getData(val)
        },
        immediate: true
      },
      // BUG4233 查看多人员工档案信息，信息数据被覆盖
      $route(to, from) {
        this.getData(to.query.id)
      },
    },
    methods: {
      getData(id) {
        getAction(this.url.queryById, { employeeId: id }).then((res) => {
          if (res.success) {
            this.model = res.result
            this.$nextTick(() => {
              this.$refs.realForm.model = res.result;
            })
            // 查询催办
            let params1 = { flowCode: this.flowCode, dataId: res.result.id };// 查询条件
            getAction(this.url.checkNotify, params1).then((res2) => {
              if (res2.result) {
                this.model.taskUrge = true;
              }
            })
            // 查询流程
            let params = { flowCode: this.flowCode, dataId: this.model.id };// 查询条件
            this.viewTrack(params);
          }
        })
      },
    }
  }
</script>
<style lang="less" scoped>
@import '~@assets/less/common.less';

.info {
  /deep/ .ant-card-head-title{
    flex: none;
    margin-right: 20px;
  }
  /deep/ .ant-card-extra{
    flex: 1;
    float: left;
  }
}
</style>
